<template>
  <el-config-provider :locale="locale">
    <RouterView></RouterView>
  </el-config-provider>
</template>
<script>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import { computed,ref } from 'vue';
   export default {
     name: '',
     data: function(){
       return {
        locale:zhCn
       }
     },
     methods:{
      getLang(){
        var lang = localStorage.getItem('lang')
        if(lang === 'en'){
          this.locale = en;
        }else{
          this.$locale = zhCn;
        }
      }
     },
     mounted(){
      var that = this;
      this.$bus.on('changeLang',()=>{
        that.getLang()
     });
    },
    unmounted(){
      this.$bus.off('changeLang');
    }
  }
</script>
<style>
  html,
  body, 
  #app{
    height: 100%;
  }
</style>